package com.usefullc.user.enums;


import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 用户等级
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum UserLevelEnum {
    UNLIMITED(-1, "无限"),

    NORMAL(0, "普通"),

    VIP1(1, "会员"),

    VIP2(2, "黄金会员"),

    VIP3(3, "钻石会员"),;

    private int code;
    private String value;

    UserLevelEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static UserLevelEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (UserLevelEnum s : UserLevelEnum.values()) {
            if (s.getCode() == code) {
                return s;
            }
        }
        return null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
